package com.lagou.service.impl;

import com.lagou.mapper.AccountMapper;
import com.lagou.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class AccountServiceImpl implements IAccountService {
    @Autowired
    private AccountMapper accountMapper;
    @Override
    public Integer transfer(String inName, String outName, double money) {
        try {
            accountMapper.transferOut(outName,money);
            accountMapper.transferIn(inName,money);
            return 1;
        } catch (Exception e) {
            return 0;
        }
    }
}
